set(LSW_DRV_LIB l_lsw_drv)
 
file(GLOB_RECURSE SOURCES "*.h" "*.c")
add_library(${LSW_DRV_LIB} SHARED ${SOURCES})

if (EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
    target_include_directories(${LSW_DRV_LIB}
        PUBLIC ${LUACLIB_SRC_DIR}
        PUBLIC ${CONAN_INCLUDE_DIRS}
        PUBLIC ${GLIB_INCLUDE_DIRS}
    )
    target_link_libraries(${LSW_DRV_LIB}
        PUBLIC ${CONAN_LIBS_HUAWEI_SECURE_C}
        PUBLIC ${GLIB2_LIBRARIES}
        PUBLIC ${GMODULE_LIBRARIES}
        PUBLIC cutils
        PUBLIC logging
        PUBLIC lsw_drv
    )
else()
    target_include_directories(${LSW_DRV_LIB}
        PUBLIC ${LUACLIB_SRC_DIR}
        PUBLIC ${GLIB_INCLUDE_DIRS}
    )
    target_link_libraries(${LSW_DRV_LIB}
        PUBLIC ${GLIB2_LIBRARIES}
        PUBLIC ${GMODULE_LIBRARIES}
        PUBLIC skynet::skynet
        PUBLIC liblogger::liblogger
        PUBLIC libmgmt_protocol::liblsw_drv
    )
endif()
# 设置生成的so文件名为lsw_drv.so
set_target_properties(${LSW_DRV_LIB} PROPERTIES OUTPUT_NAME "lsw_drv")
set_target_properties(${LSW_DRV_LIB} PROPERTIES PREFIX "")
install(TARGETS ${LSW_DRV_LIB} DESTINATION opt/bmc/luaclib)